home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / PL2BAT.BAT < prev    next >
Encoding:
DOS Batch File  |  1996-01-31  |  803 b   |  41 lines

  1. @rem = '
  2. @echo off
  3. perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  4. goto endofperl
  5. @rem ';
  6.  
  7. $head = <<'--end--';
  8. @rem = '--*-Perl-*--';
  9. @rem = '
  10. @echo off
  11. perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  12. goto endofperl
  13. @rem ';
  14. --end--
  15.  
  16. $tail = "__END__\n:endofperl\n";
  17.  
  18. if ( @ARGV ) {
  19.    LOOP:
  20.     foreach ( @ARGV ) {
  21.         open( FILE, $_ );
  22.         @file = <FILE>;
  23.         if ( grep( /:endofperl/, @file ) ) {
  24.             warn "$_ has already been converted to a batch file!!\n";
  25.             next LOOP;
  26.         }            
  27.         close( FILE, $_ );
  28.         s/\.pl//;
  29.         s/\.bat//;
  30.         open( FILE, ">$_.bat" );
  31.         print FILE $head, @file, $tail;
  32.         close( FILE );
  33.     }
  34. } else {
  35.     @file = <STDIN>;
  36.     print $head, @file, $tail;
  37. }
  38.  
  39. __END__
  40. :endofperl
  41.